// components/tabbar/tabbar.js
Component({
  pageLifetimes: {
    show: function() {
      // 页面被展示
      this.setData({
        userInfo: wx.getStorageSync('userinfo')
      })
    },
  },
  /**
   * 组件的属性列表
   */
  properties: {
    active: {
      type: String,
      value: 'home'
    },
  },

  /**
   * 组件的初始数据
   */ 
  data: {
    userInfo: wx.getStorageSync('userinfo')
  },

  /**
   * 组件的方法列表
   */
  methods: {
    onChange(event) {
      if (event.detail == 'report') {
        wx.switchTab({
          url: '/pages/report/index'
        })
      } else if (event.detail == 'home') {
        wx.switchTab({
          url: '/pages/home/home'
        })
      } else if (event.detail == 'personcenter') {
        wx.switchTab({
          url: '/pages/personCenter/personCenter'
        })
      }else if (event.detail == 'statistics') {
        wx.switchTab({
          url: '/pages/statistics/index'
        })
      }
    }
  }
})